#include "head_c.h"

void changeVirtualDir(path_t *path, char *command_path) {
    //printf("%s   %s   %d\n", (*path).path, command_path, (*path).path_tail);
    if(!strcmp(command_path, "..")) {
        int i = (*path).path_tail - 1;
        while((*path).path[i] != '/') {
            (*path).path[i] = '\0';
            i--;
        }
        (*path).path[i] = '\0';
        (*path).path_tail = strlen((*path).path);
        return;
    }
    else {
        (*path).path[(*path).path_tail] = '/';
        strcat((*path).path, command_path);
        (*path).path_tail = strlen((*path).path);
        return;
    }
}
